{{- define "main" }}

{{- $sections := $.Site.GetPage "/sections" }}
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
 <div class="container">
  <a class="navbar-brand js-scroll-trigger improve-contrast-box" href="#page-top">{{ $.Params.title }}</a>
  <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">Menu<i class="fa fa-bars"></i></button>
  <div class="collapse navbar-collapse" id="navbarResponsive">
   <ul class="navbar-nav ml-auto">
   {{- range $ind, $elem := (sort $sections.Resources ".Params.weight") }}{{- if ne $ind 0 }}
    <li class="nav-item">
     <a class="nav-link js-scroll-trigger improve-contrast-box" href="#sec-ind-{{ $ind }}">{{- $elem.Params.title -}}</a>
    </li>
   {{- end }}{{ end }}

   {{- if isset $.Params "menu" -}}
    {{- range $menuitem := $.Params.menu -}}
    <li class="nav-item">
     <a class="nav-link js-scroll-trigger improve-contrast-box" href="{{ $menuitem.url | safeHTML }}">{{- default $menuitem.url $menuitem.name | safeHTML -}}</a>
    </li>
    {{- end -}}
   {{- end -}}
   </ul>
  </div>
 </div>
</nav>

{{ range $ind, $elem := (sort $sections.Resources ".Params.weight") }}
 {{- if eq $ind 0 -}}<header><div id="intro-body">
 {{- else }}<section id="sec-ind-{{ $ind }}" class="section-{{ $ind }} content-section text-center">{{ end }}
 <div class="container"><div class="row"><div class="col-lg-8 mx-auto">
  {{- if $elem.Params.improvecontrast }}<div class="improve-contrast-box">{{ end }}
  {{ default "" $elem.Content }}
  {{- if $elem.Params.improvecontrast }}</div>{{ end }}
  {{ if eq $ind 0 }}<a href="#sec-ind-1" class="btn btn-circle js-scroll-trigger" aria-label="Scroll to Next Section"><i class="fa fa-angle-double-down animated"></i></a>{{ end -}}
 </div></div></div>

 {{ if eq $ind 0 }}</div></header>
 {{- else -}}</section>{{- end }}
{{ end }}

{{- if isset $.Params "mapsapikey" }}<div id="map"></div>{{ end }}
{{- end -}}
